#! /usr/bin/python
# -*- coding: cp1250 -*-
#sys.path.append(r'C:\x\y')

import sys
import shutil
import pepe.p_txt.bigtxt as bt

def append(files):
    '''
    Purpose : Append text files
    Syntax : txt-append.py file1 file2 [file3 ....]
    '''
    # output file encoding determined as in first file
    shutil.copy(files[0], 'txt-appended-output.txt')

    ofl = open('txt-join-output.txt','a')
    for f in files[1:]:
        for line in bt.lines(f):
            ofl.write(line)
    return 1

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print append.__doc__
    else:
        append(sys.argv[1:])

